package com.googlecode.moneyManager.service;

import com.googlecode.moneyManager.dao.CurrencyExchangeEventDAO;
import com.googlecode.moneyManager.model.CurrencyExchangeEvent;
import org.joda.time.DateTime;

import java.util.List;

/**
 * Created by sergiy.doroshenko
 * Date: 5/19/11
 */
public class CurrencyExchangeEventServiceImpl implements CurrencyExchangeEventService{

    private CurrencyExchangeEventDAO currencyExchangeEventDAO;

    @Override
    public boolean addEvent(CurrencyExchangeEvent currencyExchangeEvent) {
        currencyExchangeEventDAO.saveOrUpdate(currencyExchangeEvent);
        return true;
    }

    public CurrencyExchangeEventDAO getCurrencyExchangeEventDAO() {
        return currencyExchangeEventDAO;
    }

    public void setCurrencyExchangeEventDAO(CurrencyExchangeEventDAO currencyExchangeEventDAO) {
        this.currencyExchangeEventDAO = currencyExchangeEventDAO;
    }

    @Override
    public List<CurrencyExchangeEvent> findEvent(DateTime dateTime) {
        return this.currencyExchangeEventDAO.find(dateTime);
    }
}
